self._delete_console(c.id)
def onDomainDied(self, event, val):
+ print 'onDomainDied', "dom=", dom,
dom = int(val)
for c in self.consoles():
+ print 'onDomainDied', "dom=", dom, "dom1=", c.dom1, "dom2=", c.dom2
if (c.dom1 == dom) or (c.dom2 == dom):
self._delete_console(c.id)
else:
self.send_error()
+ def loseConnection(self):
+ if self.transport:
+ self.transport.loseConnection()
+ if self.connected:
+ reactor.callLater(0, self.connectionLost)
+
def connectionLost(self, reason=None):
self.unsubscribe()
"""
dom = int(id)
if dom <= 0: return 0
- return xc.domain_destroy(dom=dom, force=0)
+ return xc.domain_destroy(dom=dom, force=force)
def instance():
def registerChannel(self):
self.channel = self.channelFactory.domChannel(self.dom)
- #print 'registerChannel> channel=', self.channel, self
self.idx = self.channel.getIndex()
- #print 'registerChannel> idx=', self.idx
if self.majorTypes:
self.channel.registerDevice(self.majorTypes, self)
return None
def delInstance(self, instance):
- if instance in self.instances:
+ if instance.idx in self.instances:
del self.instances[instance.idx]
def createInstance(self, dom):
"""List domains."""
if help: self.help('xm_' + args[0], args); return
doms = server.xend_domains()
+ doms.sort()
print 'Dom Name Mem(MB) CPU State Time(s)'
for dom in doms:
info = server.xend_domain(dom)
d['cpu'] = int(sxp.child_value(info, 'cpu', '0'))
d['state'] = sxp.child_value(info, 'state', '??')
d['cpu_time'] = float(sxp.child_value(info, 'cpu_time', '0'))
- print ("%(dom)-4d %(name)-16s %(mem)4d %(cpu)3d %(state)5s %(cpu_time)10.2f" % d)
+ print ("%(dom)-4d %(name)-16s %(mem)7d %(cpu)3d %(state)5s %(cpu_time)7.1f" % d)
def xm_domain(self, help, args):
"""Get information about a domain."""
v = map(int, args[1:3])
server.xend_domain_pincpu(*v)
-## def xm_vif_stats(self, help, args):
-## """Get stats for a virtual interface."""
-## if help:
-## print args[0], 'DOM VIF'
-## print '\nGet stats for interface VIF on domain DOM.'
-## return
-## if len(args) != 3: self.err("%s: Invalid argument(s)" % args[0])
-## v = map(int, args[1:3])
-## print server.xend_domain_vif_stats(*v)
-
-## def xm_vif_rate(self, help, args):
-## """Set or get vif rate params."""
-## if help:
-## print args[0], "DOM VIF [BYTES USECS]"
-## print '\nSet or get rate controls for interface VIF on domain DOM.'
-## return
-## n = len(args)
-## if n == 3:
-## v = map(int, args[1:n])
-## print server.xend_domain_vif_scheduler_get(*v)
-## elif n == 5:
-## v = map(int, args[1:n])
-## server.xend_domain_vif_scheduler_set(*v)
-## else:
-## self.err("%s: Invalid argument(s)" % args[0])
-
def xm_bvt(self, help, args):
"""Set BVT scheduler parameters."""
if help: